package com.zhipu.balance.ui.home

import android.os.Bundle
import androidx.lifecycle.ViewModelProvider
import com.zhipu.balance.R
import com.zhipu.balance.databinding.ActivityGeneralBalanceBinding
import com.zhipu.balance.databinding.ActivityHomeBinding
import com.zhipu.balance.ui.BaseActivity
import com.zhipu.balance.ui.vm.home.GeneralBalanceModel
import com.zhipu.balance.utils.InitializeUtils


/**
 * 普通天平
 */
class GeneralBalanceActivity : BaseActivity<ActivityGeneralBalanceBinding>() {


    //VM
    var generalBalanceModel: GeneralBalanceModel? = null

    override fun initCreate() {
        super.initCreate()
        InitializeUtils.AppComponent()?.doInjectionMain(this)
        generalBalanceModel = ViewModelProvider(this, viewModelFactory)[GeneralBalanceModel::class.java]
    }


    /**
     * 初始化根布局
     *
     * @return 布局layout的id
     */
    override fun initContentView(savedInstanceState: Bundle?): Int {
        return R.layout.activity_general_balance
    }


    override fun initView() {
        super.initView()
        binding.viewModel = generalBalanceModel
        /**
         * 每隔milliseconds毫秒后执行next操作
         */
        generalBalanceModel?.milliseconds()
    }
}